package fr.uniscol.siecle.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.hibernate.mapping.Array;

public class AnneeScolaire implements Serializable, DonneeSiecle {

	private UAJ uaj = null;
	
	private int annee = 0;
	
	private Date debutEnseignants = null;
	
	private Date finEnseignants = null;
	
	private Date debutEleves = null;
	
	private Date finEleves = null;
	
	private List<Eleve> eleves = null;
	
	private List<Division> divisions = null;
	
	public AnneeScolaire() {
		super();
	}

	public AnneeScolaire(UAJ uaj, int annee) {
		super();
		this.uaj = uaj;
		this.annee = annee;
	}

	public UAJ getUaj() {
		return uaj;
	}

	public void setUaj(UAJ uaj) {
		this.uaj = uaj;
	}

	public int getAnnee() {
		return annee;
	}

	public void setAnnee(int annee) {
		this.annee = annee;
	}

	public Date getDebutEnseignants() {
		return debutEnseignants;
	}

	public void setDebutEnseignants(Date debutEnseignants) {
		this.debutEnseignants = debutEnseignants;
	}

	public Date getFinEnseignants() {
		return finEnseignants;
	}

	public void setFinEnseignants(Date finEnseignants) {
		this.finEnseignants = finEnseignants;
	}

	public Date getDebutEleves() {
		return debutEleves;
	}

	public void setDebutEleves(Date debutEleves) {
		this.debutEleves = debutEleves;
	}

	public Date getFinEleves() {
		return finEleves;
	}

	public void setFinEleves(Date finEleves) {
		this.finEleves = finEleves;
	}

	public List<Eleve> getEleves() {
		if(eleves == null){
			eleves = new ArrayList<Eleve>();
		}
		return eleves;
	}

	public void setEleves(List<Eleve> eleves) {
		this.eleves = eleves;
	}

	public List<Division> getDivisions() {
		if(divisions == null){
			divisions = new ArrayList<Division>();
		}
		return divisions;
	}

	public void setDivisions(List<Division> divisions) {
		this.divisions = divisions;
	}

	@Override
	public boolean equals(Object obj) {
		AnneeScolaire a = (AnneeScolaire)obj;
		return getAnnee() == a.getAnnee()
		&& getUaj().equals(a.getUaj());
	}

	@Override
	public int hashCode() {
		return getAnnee() + getUaj().hashCode();
	}
}
